<?php

namespace App\Services;

class KycService
{
    /**
     * 身份证验证
     *
     * @param string $idCard 身份证号
     * @param string $name 姓名
     * @return array
     */
    public function verifyIdCard($idCard, $name)
    {
        // Mock实现 - 假定验证成功
        \Log::info('KYC Mock: 身份证验证', [
            'id_card' => substr($idCard, 0, 6) . '****' . substr($idCard, -4),
            'name' => $name
        ]);
        
        return [
            'success' => true,
            'verified' => true,
            'verification_id' => 'kyc_' . uniqid(),
            'details' => [
                'name_match' => true,
                'id_valid' => true,
                'risk_level' => 'low'
            ]
        ];
    }
    
    /**
     * 银行卡验证
     *
     * @param string $bankCard 银行卡号
     * @param string $name 持卡人姓名
     * @return array
     */
    public function verifyBankCard($bankCard, $name)
    {
        // Mock实现
        \Log::info('KYC Mock: 银行卡验证', [
            'bank_card' => substr($bankCard, 0, 4) . '****' . substr($bankCard, -4),
            'name' => $name
        ]);
        
        return [
            'success' => true,
            'verified' => true,
            'verification_id' => 'bank_kyc_' . uniqid(),
            'bank_info' => [
                'bank_name' => '中国工商银行',
                'card_type' => '储蓄卡',
                'status' => 'active'
            ]
        ];
    }
    
    /**
     * 手机号验证
     *
     * @param string $phone 手机号
     * @param string $name 姓名
     * @return array
     */
    public function verifyPhone($phone, $name)
    {
        // Mock实现
        \Log::info('KYC Mock: 手机号验证', [
            'phone' => substr($phone, 0, 3) . '****' . substr($phone, -4),
            'name' => $name
        ]);
        
        return [
            'success' => true,
            'verified' => true,
            'verification_id' => 'phone_kyc_' . uniqid(),
            'carrier' => '中国移动',
            'status' => 'active'
        ];
    }
}